using System;
using System.Collections.Generic;
using System.Text;
using WozLib.WozObjects;

namespace WOzTestUI.WozObjects
{
  public class AudioToPlayServerObject : AudioPromptServerObject
  {

    public AudioToPlayServerObject()
    {
    }

    public AudioToPlayServerObject(long serverID)
      : base(serverID)
    {
    }

    public override WozLib.WozObjects.IServerObject GetIServerObject()
    {
      // we'll first try to let our base pull it out of the registry or create one 
      IServerObject iServerObject = base.GetIServerObject();

      // if our base didn't couldn't find the IServerObject
      // or if it's of the wrong type, we'll try to make our own
      if (iServerObject == null || !(iServerObject is AudioToPlay))
      {
        iServerObject = AudioToPlay.FromAudioToPlayServerObject(this);

        // if we do not the IWozObject we just created is not registered, register it
        if (iServerObject != null && !ServerObjectRegistry.ContainsObject(iServerObject.ServerID))
        {
          ServerObjectRegistry.RegisterObjectWithExisitingId(iServerObject);
        }
      }

      return iServerObject;
    }
  }
}